public class Hamming {

    private char[] leftStrand;
    private char[] rightStrand;

    Hamming(String leftStrand, String rightStrand) {
        this.leftStrand = leftStrand.toCharArray();
        this.rightStrand = rightStrand.toCharArray();

        if (this.leftStrand.length != this.rightStrand.length){
            throw new IllegalArgumentException("leftStrand and rightStrand must be of equal length.");
        }
    }

    int getHammingDistance() {
        int differentCount = 0;
        for (int i = 0; i < this.leftStrand.length; i++) {
            if (this.leftStrand[i] != this.rightStrand[i]){
                differentCount++;
            }
        }

        return differentCount;
    }

}
